Cytosim  PI
Cytoskeleton Simulator
SimThread Class Reference
Inheritance diagram for SimThread:
Parser

Classes

class  Lock
 
class  TryLock
 

Public Member Functions

 SimThread (void(*hold_callback)(void))
 create a SimThread with given Parser permissions More...
 
 ~SimThread ()
 destructor More...
 
Simulsim ()
 Simul reference.
 
void period (unsigned int c)
 set how many 'hold()' are necessary to halt the thread
 
void release ()
 allow the holding-thread to continue
 
int start ()
 start the thread to run a simulation More...
 
int persist ()
 continue to run the simulation after its normal termination
 
void stop ()
 gently stop the simulation More...
 
void cancel ()
 stop the simulation More...
 
void clear ()
 clear the simulation world
 
void reloadConfig ()
 halt the live simulation, read the config file and change the object parameters More...
 
int execute (std::istream &)
 execute given code More...
 
void writeState ()
 save state to file More...
 
void writeProperties (std::ostream &, bool prune)
 save properties to file
 
void openFile ()
 open file for input
 
bool good ()
 true if ready to read from file
 
int eof ()
 index of current frame
 
int frame ()
 index of current frame
 
int readFrame (int f)
 attempt to load specified frame
 
int nextFrame ()
 load next frame in file
 
Vector extension ()
 
Singlehandle () const
 return current handle
 
SinglecreateHandle (const Vector &, real range)
 make a new Single that can be controlled by the user
 
bool selectClosestHandle (const Vector &, real range)
 swith current handle
 
void detachHandle ()
 detach current handle
 
void moveHandle (const Vector &)
 move the current handle
 
void moveHandles (const Vector &)
 move all handles
 
void deleteHandles ()
 delete all handles
 
void releaseHandle ()
 detach current handle from mouse control
 

Friends

void * run_thread (void *arg)
 accessory function to call SimThread::run()
 
void * run_more_thread (void *arg)
 accessory function to call SimThread::persist()
 

Constructor & Destructor Documentation

SimThread ( void(*)(void)  hold_callback)

This uses a Parser that cannot write to disc. The function callback is called when Parser::hold() is reached.

~SimThread ( )

Known issue: When quitting the application, this destructor might be called after the destructor of Simul(), in which case it will access non-existent data, most likely causing a crash().

Member Function Documentation

void cancel ( )

kill the live-thread immediately

int execute ( std::istream &  iss)

This will execute the code specified in iss.

If the simulation is running live, the SimThread is paused, and the code is executed with another Parser. When that is completed, the SimThread is released.

The parser has full rights during the execution

void reloadConfig ( )

Read config file from the start, allowing parameters to be changed, while simulation objects remain as they are.

If the simulation is running live, this will pause it, read the config file, and allow it to proceed.

int start ( )

This attempts to start the live simulation

void stop ( )

ask the live-thread to exit at the next spontaneous halt

void writeState ( )

Save current state in two files